<div class="layui-fluid nepadmin-pad0 nepadmin-mar0 list0" id="list" lay-title="异常记录">
	<div class="layui-fluid">
		<div class="layui-row layui-col-space15">
			<div class="layui-col-md12">
				<div class="layui-card hxr-layui-card" id="listv">
					<div class="layui-form hxradmin-card-header">
						<div class="layui-form-item">
							<div class="layui-inline">
								<label class="layui-form-label">名称</label>
								<div class="layui-input-inline">
									<input type="text" name="user" placeholder="请输入设备名称/会员名称" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-inline">
								<label class="layui-form-label">状态</label>
								<div class="layui-input-inline">
									<div class="layui-unselect layui-form-select">
										<div class="layui-select-title"><input name="status" type="text" placeholder="请选择状态" value="" readonly class="layui-input layui-unselect"><i
											 class="layui-edge"></i></div>
										<dl class="layui-anim layui-anim-upbit" style="">
											<dd lay-value="" class="layui-select-tips layui-this">请选择状态</dd>
											<dd data='1'>报警中</dd>
											<dd data='2'>处理中</dd>
											<dd data='3'>已处理</dd>
										</dl>
									</div>
								</div>
							</div>
							<div class="layui-inline">
								<button class="layui-btn" data-type="reload" id="search">搜索</button>
							</div>
						</div>
					</div>
				</div>
				<div class="layui-card-body">
						<table class="layui-hide" id="list-table" lay-filter="list-table"></table>
						<script type="text/html" id="status">
						  {{#  if(d.status === 1){ }}
							<span class="layui-badge layui-bg-blue">报警中</span>
						  {{#  } else if(d.status === 2) { }}
						    <span class="layui-badge layui-bg-orange">处理中</span>
						  {{#  } else if(d.status === 3) { }}
						    <span class="layui-badge layui-bg-black">已处理</span> 
						  {{#  } }}
						</script>
					</div>
			</div>
		</div>
	</div>
</div>
<script>
	//表格数据渲染
	var formurl='device/abnormalfrom',formarea=['500px', '600px'];
	layui.use(['table', 'form','laydate'], function() {
		var table = layui.table,
			form = layui.form,
			$ = layui.$,laydate=layui.laydate;

		layui.admin.initlist(table, 'device/abnormal_log_list', 275, [
			[{
					field: 'device_abnormal_id',
					title: 'ID',
					width: 150
				}, {
					field: 'device_name',
					title: '设备名称',
					minWidth: 150
				}, {
					field: 'member_name',
					title: '会员名称',
					width: 150
				}, {
					field: 'agent_name',
					title: '代理名称',
					width: 150
				}, {
					field: 'abnormal_desc',
					title: '异常信息',
					width: 200
				}, {
					field: 'create_time',
					title: '报警时间',
					width: 200
				}, {
					field: 'status',
					title: '处理状态',
					width: 100,
					templet: '#status',
				}
			]
		])
		//监听行双击事件
	table.on('rowDouble(list-table)', function(obj){
		//查看详情
	  layui.admin.pupF('异常详情',formarea,formurl,3,obj.data);
	});
		//搜索
		$('#search').on('click', function() {
			var obj=$(this).parents('.layui-form-item');
			var val1 = obj.find('input[name="user"]').val();
			var val2 = obj.find('input[name="status"]').attr('data');
			//alert(val1);
			//执行重载
			table.reload('list-table', {
				page: {
					curr: 1 //重新从第 1 页开始
				},
				where: {
					search_text:val1,
					status:val2
				}
			});
		});
	});
</script>
